<?php
/**
 * Helpers pour les objets de type post
 *
 * @author bozec
 * @package hacride
 * @subpackage Post
 */

function display_format_excerpt($post)
{
  if (sfContext::getInstance()->getActionName() != 'displayOnePost')
  {
    return $post->getExcerpt() . "\n" .
           '<p>' . link_to('Show more&hellip;', $post->getPermalink(), 'absolute="true') . '</p>' . "\n";
    
  }
  else
  {
    return $post->getExcerpt();
  }
}

function display_body_if_one_post($post)
{
  if ($post->getExcerpt())
  {
    if (sfContext::getInstance()->getActionName() == 'displayOnePost')
    {
      return $post->getBody();
    }
    return null;
  }
  
  return $post->getBody();
}

function is_only_post()
{
  return (sfContext::getInstance()->getActionName() == 'displayOnePost') ? true : false;
}
